{template 'common/header'}
{template 'common_css'}
<style>
.jumbotron{background:#fdfdfd;}
.jumbotron p{font-size:14px;}
.jumbotron h4 {width:100%;}
.jumbotron h4 span{font-size:12px;margin:0 5px;color:#999}
.jumbotron h4 span:first-child{margin:0;color:#fff}
.jumbotron h4 img{float:left;margin:0 5px;}
.dd{margin-bottom:0;background:#f3f3f3;}
blockquote p{background:#fff;}
blockquote p img{margin:0 5px;}
blockquote p time{font-size:10px;margin:0 10px;color:#999}

.ico_scored, .ico_scored strong{background: url({TEMPLATE_WEUI}images/star2.png) repeat-x; background-size: 15px auto;}
.ico_scored{width: 75px; height: 11px; background-position: 0 -12px; margin-top: 3px;}
.ico_scored strong{display: inline-block; width: 0; height: 12px; background-position: 0 0;}
.ico_scored .score_1{width: 11px;}
.ico_scored .score_2{width: 27px;}
.ico_scored .score_3{width: 43px;}
.ico_scored .score_4{width: 59px;}
.ico_scored .score_5{width: 75px;}
</style>
<ul class="nav nav-tabs">
    <li><a href="{php echo $this->createWebUrl('category')}">返回分类列表</a></li>	
    <li {if empty($_GPC['recycle'])}class="active"{/if}><a href="{php echo $this->createWebUrl('Comment', array('cid' => $cid))}">评论记录</a></li>
	<li {if !empty($_GPC['recycle'])}class="active"{/if}><a href="{php echo $this->createWebUrl('Comment', array('cid' => $cid, 'recycle' => 1))}">评论回收站</a></li>
	
</ul>
<div class="alert alert-info info">
	<i class="fa fa-info-circle"></i>
	当前分类: {$category['title']}
</div>
<div class="main">
    <div class="panel panel-info">
        <div class="panel-heading">筛选</div>
        <div class="panel-body">
            <form action="./index.php" method="get" class="form-horizontal" role="form">
                <input type="hidden" name="c" value="site" />
                <input type="hidden" name="a" value="entry" />
                <input type="hidden" name="m" value="dayu_comment" />
                <input type="hidden" name="do" value="Comment" />
                <input type="hidden" name="cid" value="{$cid}" />
			<div class="form-group">
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">内容搜索</label>
				<div class="col-sm-8 col-lg-5">
					<input class="form-control" name="keywords" id="" type="text" value="{$_GPC['keywords']}" placeholder="可输入关键字查询评论内容"> 
				</div>
                                <div class=" col-xs-12 col-sm-2 col-lg-3">
					<button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
				</div>                          
			</div>
                <div class="form-group">
                </div>
            </form>
        </div>
    </div>
    <div class="panel panel-info">
        <div class="panel-heading">{if !empty($_GPC['recycle'])}回收站的评论{else}评论记录{/if}</div>
        <div class="panel-body">
		{loop $comments $row}
		<div class="row clearfix" id="c_{$row['id']}">
		<div class="column">
			<div class="jumbotron" id="level-list" style="padding:10px;">
				<h4><span class="label label-default">ID: {$row['id']}</span>
					<small><img src="{if !empty($row['user']['tag']['avatar'])}{$row['user']['tag']['avatar']}{else}resource/images/noavatar_middle.gif{/if}" width="48" height="48"></small>{$row['user']['nickname']}<span>{$row['createtime']}</span>
					
					{if !empty($_GPC['recycle'])}
					<a href="{php echo $this->createWebUrl('CustomDelete', array('table' => 'dayu_comment','id' => $row['id']))}"  class="badge pull-right" onclick="return confirm('删除评论，此操作不可恢复，确认删除？');return false;" data-toggle="tooltip" data-placement="bottom" title="删除" style="margin-left:5px;font-size:18px"><i class="fa fa-trash-o"></i></a>
					{/if}
					<a data="{$row['recycle']}" href="javascript:;" class="label label-default {if $row['recycle']==1}label-success{/if} pull-right" onclick="set(this,{$row['id']},'recycle','dayu_comment')">{if $row['recycle']==1}<i class="fa fa-check-square-o"></i> 正常显示{else}<i class="fa fa-trash-o"></i> 放入回收站{/if}</a>
				</h4>
				<p><span class="ico_scored"><strong class="score_{$row['score']}"></strong></span></p>
				<p>{$row['content']}</p>
				<p>
				{if is_array($row['thumb'])}
					{loop $row['thumb'] $pic}
						<img src="{php echo tomedia($pic)}" class="weui_uploader_file" style="height:80px;width:auto;">
					{/loop}
				{/if}
				</p>
				{loop $children[$row['id']] $comment}
		<blockquote>
		<p>
		<span><img src="{$avatar['tag']['avatar']}" width="32" height="32"></span>{$avatar['nickname']} 店主回复：{$comment['content']}<time>{php echo date("Y-m-d H:s", $comment['createtime'])}</time>
		<a href="{php echo $this->createWebUrl('CustomDelete', array('table' => 'dayu_comment','id' => $comment['id']))}"  class="badge pull-right" onclick="return confirm('删除评论，此操作不可恢复，确认删除？');return false;" data-toggle="tooltip" data-placement="bottom" title="删除" style="font-size:18px"><i class="fa fa-trash-o"></i></a>
		</p>
		</blockquote>
				{/loop}
			</div>
		</div>
	</div>
		{/loop}
            {$pager}	
        </div>
    </div>
</div>
	<script>
	function set(obj,id,type,table){
		$(obj).html($(obj).html() + "...");
		$.post("{php echo $this->createWebUrl('ajaxset')}",{id:id,type:type,table:table, data: obj.getAttribute("data")},function(d){
			$(obj).html($(obj).html().replace("...",""));
			if(type=='recycle'){
				$(obj).html( d.data=='1'?'<i class="fa fa-check-square-o"></i> 正常显示':'<i class="fa fa-trash-o"></i> 放入回收站');
			}
			$(obj).attr("data",d.data);
			if(d.result==1){
				$(obj).toggleClass("label-success");
				$("#c_"+id).hide();
			}
		},"json");
	}
	</script>
{template 'common/footer'}
